home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_plotutils.idb / usr / freeware / share / libplot / xfig-u_fonts.c.z / xfig-u_fonts.c
Encoding:
C/C++ Source or Header  |  1998-10-28  |  5.1 KB  |  153 lines

  1. /*
  2.  * FIG : Facility for Interactive Generation of figures
  3.  * Copyright (c) 1991 by Brian V. Smith
  4.  *
  5.  * Modified 1997 by Robert Maier to support the full set of 35 PS fonts.
  6.  *
  7.  * The X Consortium, and any party obtaining a copy of these files from
  8.  * the X Consortium, directly or indirectly, is granted, free of charge, a
  9.  * full and unrestricted irrevocable, world-wide, paid up, royalty-free,
  10.  * nonexclusive right and license to deal in this software and
  11.  * documentation files (the "Software"), including without limitation the
  12.  * rights to use, copy, modify, merge, publish, distribute, sublicense,
  13.  * and/or sell copies of the Software, and to permit persons who receive
  14.  * copies from any such party to do so, with the only requirement being
  15.  * that this copyright notice remain intact.  This license includes without
  16.  * limitation a license to do the foregoing actions under any patents of
  17.  * the party supplying this software to the X Consortium.
  18.  */
  19.  
  20. #include "fig.h"
  21. #include "resources.h"
  22. #include "u_fonts.h"
  23. #include "object.h"
  24.  
  25. /* printer font names for indicator window */
  26.  
  27. struct _xfstruct x_fontinfo[NUM_FONTS] = {
  28.     {"-*-times-medium-r-*--", (struct xfont*) NULL},
  29.     {"-*-times-medium-i-*--", (struct xfont*) NULL},
  30.     {"-*-times-bold-r-*--", (struct xfont*) NULL},
  31.     {"-*-times-bold-i-*--", (struct xfont*) NULL},
  32.  
  33.     {"-*-itc avant garde gothic-book-r-*--", (struct xfont*) NULL},
  34.     {"-*-itc avant garde gothic-book-i-*--", (struct xfont*) NULL},
  35.     {"-*-itc avant garde gothic-demi-r-*--", (struct xfont*) NULL},
  36.     {"-*-itc avant garde gothic-demi-i-*--", (struct xfont*) NULL},
  37.  
  38.     {"-*-itc bookman-light-r-*--", (struct xfont*) NULL},
  39.     {"-*-itc bookman-light-i-*--", (struct xfont*) NULL},
  40.     {"-*-itc bookman-demi-r-*--", (struct xfont*) NULL},
  41.     {"-*-itc bookman-demi-i-*--", (struct xfont*) NULL},
  42.  
  43.     {"-*-courier-medium-r-*--", (struct xfont*) NULL},
  44.     {"-*-courier-medium-o-*--", (struct xfont*) NULL},
  45.     {"-*-courier-bold-r-*--", (struct xfont*) NULL},
  46.     {"-*-courier-bold-o-*--", (struct xfont*) NULL},
  47.  
  48.     {"-*-helvetica-medium-r-normal--", (struct xfont*) NULL},
  49.     {"-*-helvetica-medium-o-normal--", (struct xfont*) NULL},
  50.     {"-*-helvetica-bold-r-normal--", (struct xfont*) NULL},
  51.     {"-*-helvetica-bold-o-normal--", (struct xfont*) NULL},
  52.  
  53.     {"-*-helvetica-medium-r-narrow--", (struct xfont*) NULL},
  54.     {"-*-helvetica-medium-o-narrow--", (struct xfont*) NULL},
  55.     {"-*-helvetica-bold-r-narrow--", (struct xfont*) NULL},
  56.     {"-*-helvetica-bold-o-narrow--", (struct xfont*) NULL},
  57.  
  58.     {"-*-new century schoolbook-medium-r-*--", (struct xfont*) NULL},
  59.     {"-*-new century schoolbook-medium-i-*--", (struct xfont*) NULL},
  60.     {"-*-new century schoolbook-bold-r-*--", (struct xfont*) NULL},
  61.     {"-*-new century schoolbook-bold-i-*--", (struct xfont*) NULL},
  62.  
  63.     {"-*-palatino-medium-r-*--", (struct xfont*) NULL},
  64.     {"-*-palatino-medium-i-*--", (struct xfont*) NULL},
  65.     {"-*-palatino-bold-r-*--", (struct xfont*) NULL},
  66.     {"-*-palatino-bold-i-*--", (struct xfont*) NULL},
  67.  
  68.     {"-*-symbol-medium-r-*--", (struct xfont*) NULL},
  69.     {"-*-itc zapf chancery-medium-i-*--", (struct xfont*) NULL},
  70.     {"-*-itc zapf dingbats-*-*-*--", (struct xfont*) NULL},
  71. };
  72.  
  73. struct _fstruct ps_fontinfo[NUM_FONTS + 1] = {
  74.     {"Default", -1},
  75.     {"Times-Roman",            0},
  76.     {"Times-Italic",            1},
  77.     {"Times-Bold",            2},
  78.     {"Times-BoldItalic",        3},
  79.     {"AvantGarde-Book",            4},
  80.     {"AvantGarde-BookOblique",        5},
  81.     {"AvantGarde-Demi",            6},
  82.     {"AvantGarde-DemiOblique",        7},
  83.     {"Bookman-Light",            8},
  84.     {"Bookman-LightItalic",        9},
  85.     {"Bookman-Demi",            10},
  86.     {"Bookman-DemiItalic",        11},
  87.     {"Courier",                12},
  88.     {"Courier-Oblique",            13},
  89.     {"Courier-Bold",            14},
  90.     {"Courier-BoldOblique",        15},
  91.     {"Helvetica",            16},
  92.     {"Helvetica-Oblique",        17},
  93.     {"Helvetica-Bold",            18},
  94.     {"Helvetica-BoldOblique",        19},
  95.     {"Helvetica-Narrow",        20},
  96.     {"Helvetica-Narrow-Oblique",    21},
  97.     {"Helvetica-Narrow-Bold",        22},
  98.     {"Helvetica-Narrow-BoldOblique",    23},
  99.     {"NewCenturySchlbk-Roman",        24},
  100.     {"NewCenturySchlbk-Italic",        25},
  101.     {"NewCenturySchlbk-Bold",        26},
  102.     {"NewCenturySchlbk-BoldItalic",    27},
  103.     {"Palatino-Roman",            28},
  104.     {"Palatino-Italic",            29},
  105.     {"Palatino-Bold",            30},
  106.     {"Palatino-BoldItalic",        31},
  107.     {"Symbol",                32},
  108.     {"ZapfChancery-MediumItalic",    33},
  109.     {"ZapfDingbats",            34},
  110. };
  111.  
  112. struct _fstruct latex_fontinfo[NUM_LATEX_FONTS] = {
  113.     {"Default",        0},
  114.     {"Roman",        0},
  115.     {"Bold",        2},
  116.     {"Italic",        1},
  117.     {"Modern",        16},
  118.     {"Typewriter",    12},
  119. };
  120.  
  121. x_fontnum(psflag, fnum)
  122.     int            psflag, fnum;
  123. {
  124.     return (psflag ? ps_fontinfo[fnum + 1].xfontnum :
  125.         latex_fontinfo[fnum].xfontnum);
  126. }
  127.  
  128. psfontnum(font)
  129. char *font;
  130. {
  131.     int i;
  132.  
  133.     if (font == NULL)
  134.     return(DEF_PS_FONT);
  135.     for (i=0; i<NUM_FONTS; i++)
  136.     if (strcasecmp(ps_fontinfo[i].name, font) == 0)
  137.         return (i-1);
  138.     return(DEF_PS_FONT);
  139. }
  140.  
  141. latexfontnum(font)
  142. char *font;
  143. {
  144.     int i;
  145.  
  146.     if (font == NULL)
  147.     return(DEF_LATEX_FONT);
  148.     for (i=0; i<NUM_LATEX_FONTS; i++)
  149.     if (strcasecmp(latex_fontinfo[i].name, font) == 0)
  150.         return (i);
  151.     return(DEF_LATEX_FONT);
  152. }
  153.